//1.请求首页数据
import request from "./request.js"
export const getHomeList = () => {
  return request.get('/api/index/index')
}

//2.请求搜索数据
export const getsearchDataList = () => request.get('/api/search/index');

//3.请求搜索页面的候选搜索
export const getSearchTipList = params => request.get('/api/search/helper', {
  params
})

//4.请求商品数据
export const getProductList = function (params) {
  return request.get('/api/goods/list', {
    params: params
  })
}

//5.删除搜索历史记录
export const clearHistory = () => {
  return request.post('/api/search/clearhistory')
}

//6.用户登录
export const getLogin = function (params) {
  return request.post('/api/auth/loginByWeb', params);
}

//7.请求商品详情数据
export const getProductDetail = (params) => request.get('/api/goods/detail', {
  params
})

//8.请求商品详情里的相关产品数据 
export const getRelateProduct = params => request.get('/api/goods/related', {
  params
})

//9.获取购物车产品数量
export const getGoodsCount = () => request.get('/api/cart/goodscount', {})


//10.加入购物车
export const addToCart = (params) => request.post('/api/cart/add', params);

//11.获取购物车数据
export const getCartListData = () => request.get('/api/cart/index');

//12.点击切换商品选中状态（含全选）
export const getCartChecked = (params) => request.post('/api/cart/checked', params);

//13.商品步进器
export const getCartStep = params => request.post('/api/cart/update', params)

//14.删除购物车商品
export const deleteCartGood = params => request.post('/api/cart/delete', params);